<?php
/**
 * User: Kris
 * Date: 1/12/12
 * Time: 11:13 PM
 */

require_once APPPATH . 'core/controller.php';

class DebugDemo extends CI_Controller
{
    /**
     * @var Debugger
     */
    public $debugger;

    public function index()
    {
        // simple message to console
        $this->debugger->debug("A very simple message");

        // vaiable to console
        $x = 3;
        $y = 5;
        $z = $x / $y;
        $this->debugger->debug("Variable Z: ", $z);

        // a warnign
        $this->debugger->debug("A simple Warning", null, WARN);

        // info
        $this->debugger->debug("A simple Info message", null, INFO);

        // An error
        $this->debugger->debug("A simple error messsage", null, ERROR);

        // Array in console
        $fruits = array("banana", "apple", "strawberry", "pineaple");
        $fruits = array_reverse($fruits);
        $this->debugger->debug("Fruits array", $fruits);

        // object to console
        $book = new stdClass;
        $book->title = "Harry Potter and the Prisoner of Azkaban";
        $book->author = "J. K. Rowling";
        $book->publisher = "Arthur A. Levine Books";
        $book->amazon_link = "http://www.amazon.com/dp/0439136369/";
        $this->debugger->debug("Object", $book);

        echo 'Check your javascript console';
    }
}
